package io.gitee.wiqer.simple;

public class SolutionNC7_MaxProfit {
    /**
     *
     * @param prices int整型一维数组
     * @return int整型
     */
    public int maxProfit (int[] prices) {
        int min = prices[0];
        int max = 0;
        for(int i=0;i<prices.length;i++){
            min=Math.min(prices[i],min);
            max=Math.max(max,prices[i]-min);
        }
        return max;
    }
}
